{include file="public_head" /}

<!-- Select2 -->
<link href="__STATIC__/css/select/select2.min.css" rel="stylesheet">

<body class="nav-md">

<div class="container body">

    <div class="main_container">

        {include file="public_sidebar,public_nav" /}
        <!-- page content -->
        <div class="right_col" role="main">
            <div class="">

                <div class="page-title">
                    <div class="title_left">
                        <h3>订单详细管理</h3>
                    </div>
                </div>
                <div class="clearfix"></div>
                <div class="row">
                    <div class="col-md-12 col-sm-12 col-xs-12">
                        <div class="x_panel">
                            <div class="x_title">
                                <h2>查看订单
                                    <!--<small>different form elements</small>-->
                                </h2>
                                <ul class="nav navbar-right panel_toolbox">
                                    <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                    </li>
                                    <li><a class="close-link"><i class="fa fa-close"></i></a>
                                    </li>
                                </ul>
                                <div class="clearfix"></div>
                            </div>

                            <div class="x_content">
                                <div id="printArea">
                                <br/>
                                <form class="form-horizontal form-label-left" enctype="multipart/form-data" action=""
                                      method="post" id="registerForm">

                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">订 单 号：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>{$item.order_number}&nbsp;&nbsp;&nbsp;&nbsp;</div>
                                        </div>
                                    </div>
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">买家账号：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>{$item.username}&nbsp{$item.car_number}</div>
                                        </div>
                                    </div>
                                    <div class="form-group dc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">是否认证：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>{switch name="$item.is_certification"}{case 1}未认证{/case}{case 3}等待认证{/case}{case 2}已认证{/case}{/switch}</div>
                                        </div>
                                    </div>
                                    <div class="form-group dc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">绩效订单：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>
                                                {switch name="item.finance_order"}
                                                {case 1}业务员订单{/case}
                                                {case 2}二维码订单{/case}
                                                {case 3}门店订单{/case}
                                                {case 4}普通订单{/case}
                                                {default /}-
                                                {/switch}
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-group dc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">(线上/下)订单：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>
                                                {switch name="item.order_online"}
                                                {case 1}线上订单{/case}
                                                {case 2}线下订单{/case}
                                                {default /}-
                                                {/switch}
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">下单/退款时间：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>{$item.create_time}{in name="$item.status" value="10,11,12"} / {$item.refund_create_time}{/in}</div>
                                        </div>
                                    </div>
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">总金额：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>{$item.amount}&nbsp;&nbsp;&nbsp;&nbsp;</div>
                                        </div>
                                    </div>
                                    {in name="$item.status" value="10,11,12"}
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">退款金额：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>{$refund.amount}&nbsp;&nbsp;&nbsp;&nbsp;</div>
                                        </div>
                                    </div>
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">退款理由：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>{$refund.title}&nbsp;&nbsp;&nbsp;&nbsp;</div>
                                        </div>
                                    </div>
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">退款说明：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>{$refund.explain}&nbsp;&nbsp;&nbsp;&nbsp;</div>
                                        </div>
                                    </div>
                                    {/in}
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">买家留言：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>{$item.explain}&nbsp;&nbsp;&nbsp;&nbsp;</div>
                                        </div>
                                    </div>
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">支付方式：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>{switch name="item.pay_way"}{case 1}线上{/case}{case 2}线下{/case}{/switch}&nbsp;&nbsp;&nbsp;&nbsp;</div>
                                        </div>
                                    </div>
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">支付类型：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>{switch name="item.pay_type"}{case 1}微信{/case}{case 2}支付宝{/case}{default /}-{/switch}&nbsp;&nbsp;&nbsp;&nbsp;</div>
                                        </div>
                                    </div>
                                    {eq name="$item.t_type" value="1"}
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">礼包标题：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>{$item.gift_title}</div>
                                        </div>
                                    </div>

                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">到期时间：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>{$item.use_time}&nbsp;&nbsp;&nbsp;&nbsp;使用期限({$item.day})天</div>
                                        </div>
                                    </div>
                                    <div class="form-group service_people tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">礼包详情：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <table width="100%" border="1" style="font-family: '微软雅黑';">
                                                <tr align="center" style="font-size: 16px;">
                                                    <td width="160">服务分类</td>
                                                    <td width="160">服务内容</td>
                                                    <td width="90">礼包总次数(剩余次数)</td>
                                                </tr>
                                                {volist name='order_gift_count' id='vo'}
                                                <tr align="center">
                                                    <td>{$vo.cat_name|default=''}</td>
                                                    <td>{$vo.cat_name2|default=''}</td>
                                                    <td>{$vo.gift_origin_count|default=''}({$vo.gift_count|default=''})</td>
                                                </tr>
                                                {/volist}
                                            </table>
                                        </div>
                                    </div>


                                    <div class="form-group service_people">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">服务人员与提成：</label>
                                        <div class="col-md-7 col-sm-7 col-xs-12" style="margin-top: 10px;">
                                            <table width="100%" border="1" style="font-family: '微软雅黑';">
                                                <tr align="center" style="font-size: 16px;">
                                                    <td width="160">服务门店</td>
                                                    <td width="70">服务人员</td>
                                                    <td width="70">服务分类</td>
                                                    <td width="150">服务内容</td>
                                                    <td width="70">提成金额</td>
                                                    <td width="150">消费日期</td>
                                                    <td width="150">用户是否确认使用</td>
                                                    {eq name=":session('auding_status')" value="2"}
                                                    <td>操作</td>
                                                    {/eq}
                                                </tr>
                                                {volist name='gift_assignor_records' id='vo'}
                                                <tr align="center">
                                                    <td>{$vo.shop_title|default=''}</td>
                                                    <td>{$vo.name|default=''}</td>
                                                    <td>{$vo.cat_name|default=''}</td>
                                                    <td>{$vo.assignor_content|default=''}</td>
                                                    <td>{$vo.assignor_price|default=''}</td>
                                                    <td>{$vo.create_time|default=''}</td>
                                                    <td>
                                                        {switch name="$vo.is_agree"}
                                                        {case 1}未确认{/case}
                                                        {case 2}已确认{/case}
                                                        {/switch}
                                                    </td>
                                                    {eq name=":session('auding_status')" value="2"}
                                                    <td onclick="del({$vo.id})">删除</td>
                                                    {/eq}
                                                </tr>
                                                {/volist}
                                            </table>
                                        </div>
                                    </div>

                                    {if condition="strtotime($item.use_time) gt time()" }
                                    {eq name=":session('auding_status')" value="1"}
                                    <div class="form-group service_people tc" >
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">服务人员提成：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <table class="table table-striped table-bordered table-hover">
                                                <thead>
                                                <th>服务人员</th>
                                                <th>服务分类</th>
                                                <th>服务内容</th>
                                                <th>服务金额</th>
                                                <th>操作</th>
                                                </thead>
                                                <tbody id="fieldtr">

                                                <tbody align="right">
                                                <tr>
                                                    <td colspan="5"><a href="javascript:;" class="addNewTr" title="新增一条">新增一条</a></td>
                                                </tr>
                                                </tbody>

                                            </table>
                                        </div>
                                    </div>
                                    {/eq}
                                    {eq name=":session('auding_status')" value="2"}
                                    <div class="form-group service_people tc" id="service_people">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">服务人员提成：</label>
                                        <div class="col-md-7 col-sm-6 col-xs-12">
                                            <table class="table table-striped table-bordered table-hover">
                                                <thead>
                                                <th>服务门店</th>
                                                <th>服务人员</th>
                                                <th>服务分类</th>
                                                <th>服务内容</th>
                                                <th>服务金额</th>
                                                <th>操作</th>
                                                </thead>
                                                <tbody id="fieldtr">

                                                <tbody align="right">
                                                <tr>
                                                    <td colspan="6"><a href="javascript:;"  class="addNewTrshop" title="新增一条">新增一条</a></td>
                                                </tr>
                                                </tbody>

                                            </table>
                                        </div>
                                    </div>
                                    {/eq}
                                    {/if}
                                    <div class="form-group service_people tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">商品记录：</label>
                                        <div class="col-md-8 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <table width="100%" border="1" style="font-family: '微软雅黑';">
                                                <tr align="center" style="font-size: 16px;">
                                                    <td >服务门店</td>
                                                    <td>商品规格</td>
                                                    <td >数量</td>
                                                    <td >消费日期</td>
                                                    {eq name=":session('auding_status')" value="2"}
                                                    <td>操作</td>
                                                    {/eq}
                                                </tr>
                                                {volist name='service_order_goods' id='vo'}
                                                <tr align="center">
                                                    <td>{$vo.shop_title|default=''}</td>
                                                    <td>{$vo.spec_id}-{$vo.title|default=''}-{$vo.attribute|default=''}</td>
                                                    <td>{$vo.number|default=''}</td>
                                                    <td>{$vo.create_time|default=''}</td>
                                                    {eq name=":session('auding_status')" value="2"}
                                                    <td onclick="del({$vo.id})">删除</td>
                                                    {/eq}
                                                </tr>
                                                {/volist}
                                            </table>
                                        </div>
                                    </div>
                                    {if condition="strtotime($item.use_time) gt time()" }
                                    <div class="form-group tc" id="service_people">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">商品添加：</label>
                                        <div class="col-md-8 col-sm-6 col-xs-12">
                                            <table class="table table-striped table-bordered table-hover">
                                                <thead>
                                                <th>商品分类</th>
                                                <th>商品规格</th>
                                                <th>商品数量</th>
                                                <th>创建时间</th>
                                                <th>操作</th>
                                                </thead>
                                                <tbody id="fieldtrgoods">

                                                </tbody>
                                                <tbody align="right">
                                                <tr>
                                                    <td colspan="5"><a href="javascript:;" class="addNewTrgoods" title="新增一条" >新增一条</a></td>
                                                </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    {/if}
                                    {else/}
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">会员卡类型：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>{switch name="$item.mc_type"}{case 1}年卡- {/case}{case 2}次卡({$item.mc_count})次 {/case}{/switch}</div>
                                        </div>
                                    </div>
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">会员卡标题：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>{$item.mc_title}</div>
                                        </div>
                                    </div>
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">会员卡有效时间：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div>{:substr($item.mc_start_time,0,10)} / {:substr($item.mc_end_time,0,10)}</div>
                                        </div>
                                    </div>
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">会员卡图片：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <div><img src="/{$item.mc_single_pic}" height="100"/></div>
                                        </div>
                                    </div>


                                    {/eq}
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">订单状态：</label>
                                        <div class="col-md-1 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            {switch name="item.status"}
                                            {case 1}未支付{/case}
                                            {case 6}进行中{/case}
                                            {case 5}待评价{/case}
                                            {case 4}完成{/case}
                                            {case 10}退款中{/case}
                                            {case 11}退款成功{/case}
                                            {case 12}退款失败{/case}
                                            {case 20}已取消({$item.cancel_content}){/case}
                                            {/switch}
                                            <br/>
                                            {if condition="$item.status eq 2"}
                                            <input type="checkbox" name="status"  value="3" datatype="*" nullmsg="请选择已发货！" > 已发货
                                            {/if}
                                        </div>
                                    </div>
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">是否开发票：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            {switch name="item.bill"}{case 1}开{/case}{case 2} 否{/case}{default /}{/switch}<br>
                                            {eq name="$item.bill" value="1"}
                                            发票类型：{switch name="item.bill_type"}{case 1}电子{/case}{case 2} 普通{/case}{case 3} 增值税{/case}{default /}{/switch}<br>
                                            发票抬头：{switch name="item.bill_header"}{case 1}个人{/case}{case 2} 单位{/case}{default /}{/switch}<br>
                                            发票内容：{$item.bill_content}<br>
                                            发票电话：{$item.bill_phone}<br>
                                            电子邮箱：{$item.bill_email}<br>

                                            {/eq}
                                        </div>
                                    </div>
                                    {in name="item.status" value="1,6,5,4"}
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">备注信息：</label>
                                        <div class="col-md-1 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                                <textarea type="text" placeholder="备注" style="width: 500px;height: 100px;"
                                                          class="form-control col-md-7 col-xs-12" name="explain">{$item.explain|default=''}</textarea>

                                        </div>
                                    </div>
                                    {/in}
                                    {if condition="strpos('11,10,12',(string)$item.status) !== false"}
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">退款审核记录：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <table width="80%" border="1" style="font-family: '微软雅黑';">
                                                <tr align="center" style="font-size: 16px;">
                                                    <td>申请者</td>
                                                    <td>申请门店</td>
                                                    <td>审核状态</td>
                                                    <td>审核时间</td>
                                                    <td>失败原因</td>
                                                </tr>
                                                {volist name='refund_order_audit_records' id='goods_list'}
                                                <tr align="center">
                                                    <td>{$goods_list.username|default=''}</td>
                                                    <td>{$goods_list.shop_title|default=''}</td>
                                                    <td>
                                                        {switch name="$goods_list.status"}
                                                        {case 11}审核成功{/case}
                                                        {case 12}审核失败{/case}
                                                        {/switch}
                                                    </td>
                                                    <td>{$goods_list.create_time|default=''}</td>
                                                    <td>{$goods_list.fail_explain|default=''}</td>
                                                </tr>
                                                {/volist}
                                            </table>
                                        </div>
                                    </div>
                                    {/if}
                                    {in name="item.status" value="10"}
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">退款状态：</label>
                                        <div class="col-md-1 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                            <select name="status" class="form-control" style="width: 200px;float: left;" tabindex="-1" {in name='item.status' value='11,12'}disabled{/in}>
                                            <option value="11" {eq name='item.status' value='11'}selected{/eq}>申请退款成功</option>
                                            <option value="12" {eq name='item.status' value='12'}selected{/eq}>申请退款失败</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group tc">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">未退款理由：</label>
                                        <div class="col-md-1 col-sm-6 col-xs-12" style="margin-top: 10px;">
                                                <textarea type="text" placeholder="未退款理由,不填写留空" style="width: 500px;height: 100px;"
                                                          class="form-control col-md-7 col-xs-12" name="fail_explain">{$refund_find.message|default=''}</textarea>
                                            <div style="width:500px;clear: both">
                                                <span style="font-size: 16px;color: red">注：只有在退款状态是退款失败的时候填写</span>
                                            </div>
                                        </div>
                                    </div>
                                    {/in}
                                </div>
                                {eq name="$item.t_type" value="1"}
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" style="text-align: right">是否隐藏会员提成：</label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <label class="radio_box">
                                        <input type="radio" name="type" id="status_1" class="cartradio"
                                               value="1"
                                               datatype="*"
                                               nullmsg="请选择会员卡类型！" errormsg="请选择会员卡类型！"
                                               {eq name='item.type|default="1"' value='1' }
                                               checked
                                               {/eq}
                                        >&nbsp;&nbsp;
                                        <label for="status_1"></label>
                                        <span>否</span>
                                        &nbsp;&nbsp;
                                    </label>
                                    <label class="radio_box">
                                        <input type="radio" name="type" id="status_2" class="cartradio"
                                               value="2"
                                               datatype="*"
                                               nullmsg="请选择会员卡类型！" errormsg="请选择会员卡类型！"
                                               {eq name='item.type|default=""' value='2' }
                                               checked
                                               {/eq}
                                        >&nbsp;&nbsp;
                                        <label for="status_2"></label>
                                        <span>是</span>
                                        &nbsp;&nbsp;
                                    </label>
                                </div>
                            </div>
                                {/eq}
                                <div style="clear: both"></div>
                                {eq name="$item.t_type" value="1"}
                                <div class="form-group">
                                    <label class="control-label col-md-3 col-sm-3 col-xs-12" style="text-align: right">只保留提成：</label>
                                    <div class="col-md-6 col-sm-6 col-xs-12">
                                        <label class="radio_box">
                                            <input type="radio" name="type2" id="status_3" class="cartradio"
                                                   value="1"
                                                   datatype="*"
                                                   nullmsg="请选择会员卡类型！" errormsg="请选择会员卡类型！"
                                                   {eq name='item.type|default="1"' value='1' }
                                                   checked
                                                   {/eq}
                                            >&nbsp;&nbsp;
                                            <label for="status_3"></label>
                                            <span>否</span>
                                            &nbsp;&nbsp;
                                        </label>
                                        <label class="radio_box">
                                            <input type="radio" name="type2" id="status_4" class="cartradio"
                                                   value="2"
                                                   datatype="*"
                                                   nullmsg="请选择会员卡类型！" errormsg="请选择会员卡类型！"
                                                   {eq name='item.type|default=""' value='2' }
                                                   checked
                                                   {/eq}
                                            >&nbsp;&nbsp;
                                            <label for="status_4"></label>
                                            <span>是</span>
                                            &nbsp;&nbsp;
                                        </label>
                                    </div>
                                </div>
                                {/eq}

                                    <div class="form-group">
                                        <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                            {eq name="$item.t_type" value="1"}
                                            {if condition="strtotime($item.use_time) gt time()" }
                                            {in name="$item.status" value="6,5,4"}
                                            <button type="submit" class="btn btn-primary">提交记录</button>
                                            {/in}
                                            {/if}
                                            {if condition="$item.status eq 10 && $refund_button == true && strpos('7,8,9,10',(string)session('role_id')) !== false"}
                                            <button type="submit" class="btn btn-primary">退款申请</button>
                                            {/if}
                                            {/eq}
                                            <a type="reset" class="btn btn-success" onclick="history.go(-1)">返回</a>
                                            {in name="$item.status" value="50,1"}
                                            <a onclick="cancel({$item.member_id},{$item.id})" class="btn btn-primary">取消订单</a>
                                            {/in}
                                            {eq name="$item.t_type" value="1"}
                                            <button type="button"  class="btn btn-danger" id="btnPrint">打印文本区域</button>
                                            {/eq}
                                        </div>
                                    </div>

                                </form>

                                <div class="row">

                                    <div class="x_content col-md-12 col-sm-12 col-xs-12">
                                        <div class="form-group">
                                            <label class="control-label col-md-3 col-sm-3 col-xs-12"
                                                   style="text-align: right">会员付款码：</label>
                                            <div class="col-md-3 col-sm-6 col-xs-12">
                                                <input type="text" placeholder="线下扫码机获得" onchange="" {neq
                                                       name="$item.status" value="1" }disabled{/neq}
                                                class="form-control col-md-7 col-xs-12" name="auth_code"
                                                value="{$item.auth_code|default=''}" datatype="*" nullmsg="请填写运费金额"
                                                >
                                            </div>
                                            {eq name="$item.status" value="1"}
                                            <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                                <a type="reset" class="btn btn-success" onclick="mic_w_pay()">微信支付</a>
                                                <a type="reset" class="btn btn-success" onclick="mic_a_pay()">支付宝支付</a>
                                                <input type="hidden" name="order_amount" value="{$item.amount}"/>
                                                <input type="hidden" name="order_number" value="{$item.order_number}"/>

                                            </div>
                                            {/eq}
                                        </div>
                                    </div>
                                </div>



                    </div>
                </div>


            </div>
            <!-- /page content -->

        </div>

    </div>
</div>

{include file="public_foot" /}
<!-- validform -->
<script src="__STATIC__/js/Validform_v5.3.2_min.js"></script>
<script src="__STATIC__/js/layer.js"></script>
<!--select-->
<script src="__STATIC__/js/select/select2.full.min.js"></script>
<script>
    function mic_w_pay() {
        var auth_code = $("[name='auth_code']").val();
        var out_trade_no = $("[name='order_number']").val();
        var price = $("[name='order_amount']").val();
        if(!auth_code){
            layer.msg('付款码不能为空');
            return;
        }
        $.ajax({
            type: "POST",
            url: "{:url('mic/w_pay')}",
            data: {auth_code:auth_code, out_trade_no:out_trade_no,price:price},
            dataType: "json",
            success: function(ret){
                if(ret == true){
                    layer.msg('支付成功');
                    history.go(0);
                }
                else{
                    layer.msg('支付失败');
                }
            }

        });
    }

    function mic_a_pay() {

        var auth_code = $("[name='auth_code']").val();
        var out_trade_no = $("[name='order_number']").val();
        var price = $("[name='order_amount']").val();

        if(!auth_code){
            layer.msg('付款码不能为空');
            return;
        }

        $.ajax({
            type: "POST",
            url: "{:url('mic/a_pay')}",
            data: {auth_code:auth_code, out_trade_no:out_trade_no,price:price},
            dataType: "json",
            success: function(ret){
                if(ret == true){
                    layer.msg('支付成功');
                    history.go(0);
                }
                else{
                    layer.msg('支付失败');
                }
            }

        });
    }
    function del(id) {

        $.ajax({
            type: "POST",
            url: "{:url('console/gift_order/delete')}",
            data: {id:id},
            dataType: "json",
            success: function(data){
                //  $('#resText').empty();   //清空resText里面的所有内容
                //var obj = JSON.parse(data);
                if(data.code == 200){
                    layer.msg('删除成功');
                    history.go(0);
                    //window.location.href = "{:url('index')}"
                }
                else{
                    layer.msg('取消失败');
                }

            }
    });
    }
    function cancel(member_id,order_id){
        $(function(){
//            var member_id = member_id;
            //var order_id = order_id;
            //$('#send').click(function(){

            $.ajax({

                type: "POST",

                url: "{:url('index/order/cancel')}",

                data: {member_id:member_id, order_id:order_id},

                dataType: "json",

                success: function(data){

                    //  $('#resText').empty();   //清空resText里面的所有内容
                    //var obj = JSON.parse(data);
                    if(data.code == 200){
                        layer.msg('订单取消成功');
                        history.go(0);
                        window.location.href = "{:url('index')}"
                    }
                    else{
                        layer.msg('取消失败');
                    }
                    //var html = '';

//                        $.each(data, function(commentIndex, comment){
//
//                            html += '<div class="comment"><h6>' + comment['username']
//
//                                + ':</h6><p class="para"' + comment['content']
//
//                                + '</p></div>';
//
//                        });
//
//                        $('#resText').html(html);

                }

            });

            /// });

        });
    }
</script>
<script>

    // validform
    $(function () {

        $.Tipmsg.r = null;

        var showmsg = function (msg) {
            //假定你的店铺商品提示方法为showmsg， 在方法里可以接收参数msg，当然也可以接收到o及cssctl;
            alert(msg);
        }

        // select2
        $(".select2_single").select2({
            placeholder: "请选择快递公司",
            allowClear: true
        });

        $(".select2_single2").select2({
            placeholder: "请选择订单状态",
            allowClear: true
        });

        $("#registerForm").Validform({
            tiptype: function (msg) {
                layer.msg(msg);
            },
            tipSweep: true
        });
    })

    function delThisTr(trobj)
    {
        trobj.parent().parent().remove();
    }

    function delThis(trobj,id)
    {
        if(confirm('确认删除？')){
            $.ajax({
                url : '{:url("service_order/shop_assignor_records")}',
                data:{'id':id},
                dataType:'html',
                success:function(data){
                    data = JSON.parse(data);
                    console.log(data)
                    if(data.code == 200){
                        layer.msg('删除成功');
                        trobj.parent().parent().remove();
                    }else{
                        layer.msg(data.message);
                    }
                }
            });
        }
    }
    var assgioner = {$shop_assignor};
    console.log(assgioner);
    var s = [];

    s = '<tr><td><select name="status" class="form-control" tabindex="-1">' + ss
    s += '</select></td>';
    console.log(s);
    var ss = [];
    $.each(assgioner, function(k,v){
        ss += '<option value="'+v.id+'">'+v.name+'</option>';
    });
    //服务人员门店
    var gift_c;
    $.each({$now_gift_count}, function(k,v){ //礼包
        gift_c += '<option value="'+v.id+'">'+v.cat_name+'</option>';
    });
    var gift_shop_content;
    $.each({$service_people_price2}, function(k,v){ //服务人员提成
        gift_shop_content += '<option value="'+v.id+'">'+v.cat_name+'</option>';
    });
    $(".addNewTr").click(function(){
        str = '<tr><td><select name="assignor_id[]" class="form-control" tabindex="-1">' + ss +
            '</select></td>' +
            '<td><select name="single_id[]" onchange="single2(this.value,this)" class="form-control" tabindex="-1">' + gift_c +
            '<td><select name="assignor_content[]" onchange="person_price(this.value,this)" class="form-control" tabindex="-1">' + gift_shop_content +
            '<td><input name="assignor_price[]" readonly class="form-control" value="'+{$service_people_price2}[0]['person_price']+'" /></td>'+
        '<td><a href="javascript:;" onclick="delThisTr($(this))">删除</a></td></tr>';
        $("#fieldtr").append(str);
    });

//    $(".addNewTr").click(function(){
//        str =
//            '<tr><td><input type="text" name="assignor_id[]"  /></td>' +
//            '<td><input type="text" name="assignor_price[]"  /></td>' +
//            '<td><input type="text" name="assignor_content[]" /></td>' +
//            '<td><a href="javascript:;" onclick="delThisTr($(this))">删除</a></td></tr>';
//        $("#fieldtr").append(str);
//    });
    var sss = [];//总后台服务人员
    var shop_list = {$shop_list};
    $.each(shop_list, function(k,v){
        sss += '<option value="'+v.id+'">'+v.shop_title+'</option>';
    });
    $(".addNewTrshop").click(function(){
        str = '<tr><td><select onchange="shop(this.value,this)" name="shop_id[]" class="form-control" tabindex="-1">' + sss+
            '</select><td id="assignor_id"><select name="assignor_id[]" class="form-control" tabindex="-1">' + ss +
            '</select></td>' +
            '<td id="server_people_price"><select name="single_id[]" onchange="single2(this.value,this)" class="form-control" tabindex="-1">' + gift_c +
            '</select></td>' +
            '<td><select name="assignor_content[]" onchange="person_price(this.value,this)" class="form-control" tabindex="-1">' + gift_shop_content +
            '<td><input name="assignor_price[]" readonly class="form-control" value="'+{$service_people_price2}[0]['person_price']+'" /></td>'+
            '<td><a href="javascript:;" onclick="delThisTr($(this))">删除</a></td></tr>';
        $("#fieldtr").append(str);
    });
    function delThisTrr(trobj)
    {
        trobj.parent().parent().remove();
    }

    function shop(id,t){
        //覆盖就分类 //人员
        $.ajax({
            url : '{:url("shop_assignor")}',
            data:{'shop_id':id},
            dataType:'json',
            success:function(data){
                var str = [];
                console.log(data);
                str = '<select name="assignor_id[]" class="form-control" tabindex="-1">';
                $.each(data, function(k,v){
                    str += '<option value="'+v.id+'">'+v.name+'</option>';
                });
                str += '</select>';
                $(t).parent().next().html(str);
                console.log(str);
            }
        });
        var order_id = "{:input('id')}";
        //覆盖旧的服务金额
        $.ajax({ //当前礼包一级类
            url : '{:url("now_gift_count")}',
            data:{'shop_id':id,'order_id':order_id},
            dataType:'json',
            success:function(data){
                var str = [];
                console.log(data);
                str = '<select name="single_id[]" onchange="single2(this.value,this)" class="form-control" tabindex="-1">';
                $.each(data.one_level, function(k,v){
                    str += '<option value="'+v.id+'">'+v.cat_name+'</option>';
                });
                str += '</select>';
                $(t).parent().next().next().html(str);
                var assignor_content = '<select name="assignor_content[]" onchange="person_price(this.value,this)" class="form-control" tabindex="-1">';
                $.each(data.two_level, function(k,v){
                    assignor_content += '<option value="'+v.id+'">'+v.cat_name+'</option>';
                });
                assignor_content += '</select>';
                $(t).parent().next().next().next().html(assignor_content);
                var assignor_price = '<input name="assignor_price[]" readonly class="form-control" value="'+data['two_level'][0]['person_price']+'" />';
                $(t).parent().next().next().next().next().html(assignor_price);

            }
        });

    }
    function single2(id,t) { //获得2级类以及价格
        var shop_id = 0;
        var order_id = {$item.id};
        if({:session('auding_status')} == 1){
             shop_id = "{:session('shop_id')}";
        }else{
             shop_id = $(t).parent().prev().prev().find('select').val();
        }
        $.ajax({
            url : '{:url("single/ajax2")}',
            data:{'id':id,'shop_id':shop_id,'order_id':order_id},
            dataType:'json',
            success:function(data){
                var str = [];
                console.log(data);
                str = '<select name="assignor_content[]" onchange="person_price(this.value,this)" class="form-control" tabindex="-1">';
                $.each(data, function(k,v){
                    str += '<option value="'+v.id+'">'+v.cat_name+'</option>';
                });
                str += '</select>';
                $(t).parent().next().html(str);
                var person_price = [];
                person_price = '<td><input name="assignor_price[]" readonly class="form-control" value="'+data[0]['person_price']+'" /></td>';
                $(t).parent().next().next().html(person_price);
                console.log(person_price);
            }
        });
    }

    function person_price(id,t) { //二级类获得字的价格
        if({:session('auding_status')} == 1){
            var shop_id = "{:session('shop_id')}";
        }else{
            var shop_id = $(t).parent().prev().prev().prev().find('select').val();
        }
        $.ajax({
            url : '{:url("single/ajax4")}',
            data:{'id':id,'shop_id':shop_id},
            dataType:'json',
            success:function(data){
                console.log(data);
                var person_price = [];
                person_price = '<td><input name="assignor_price[]" readonly class="form-control" value="'+data+'" /></td>';
                $(t).parent().next().html(person_price);
            }
        });
    }
</script>
<script src="/jquery.PrintArea.js" type="text/JavaScript" language="javascript"></script>
<script>
    $('#status_2').click(function () {

        $('.service_people').hide();

    });
    $('#status_1').click(function () {

        $('.service_people').show();

    });
    $("#btnPrint").click(function(){
        $("#printArea").printArea();
    });
    $("#btnPrintFull").click(function(){
        $("body").printArea();
    });

    $('#status_4').click(function () { //是隐藏提成
        $('#service_people').show();
        $('.tc').hide();
    });
    $('#status_3').click(function () {
        $('#service_people').show();
        $('.tc').show();
    });
</script>
        <script>
            //分类
            var category = {$category};
            var cat_list = '<option value="0">'+'&nbsp&nbsp'.repeat(1)+'|--全部分类</option>';
            var repeat = '-';
            $.each(category, function(k,v){
                cat_list += '<option value="'+v.id+'">'+'&nbsp&nbsp'.repeat(v.count)+'|--'+v.title+'</option>';
            });
            //规格商品 门店或全部
            var spec_attr_list = {$spec_attr_list};
            var spec_list = [];
            console.log(spec_attr_list);
            $.each(spec_attr_list, function(k,v){
                spec_list += '<option value="'+v.id+'">'+'&nbsp&nbsp'.repeat(v.count)+'|--'+v.shop_title+'-'+v.title+'-'+v.attribute+'-'+v.inventory+'</option>';
            });
            console.log(spec_list);
            $(".addNewTrgoods").click(function(){
                str =
                    '<tr>' +
                    '<td><select name="cat_id[]" onchange="goods_list(this.value,this)" class="form-control" tabindex="-1">' + cat_list +
                    '</select></td>' +
                    '<td><select name="spec_id[]" id="spec" class="form-control" tabindex="-1">' + spec_list +
                    '</select></td>' +
                    '<td><input type="text" name="number[]" oninput="inventory(this,this.value)"  /></td>'+
                    '<td><input type="text" value="{:date('Y-m-d H:i:s',time())}" /></td>' +
                '<td><a href="javascript:;" onclick="delThisTrgoods($(this))">删除</a></td>' +
                '</tr>';
                $("#fieldtrgoods").append(str);
            });
            function delThisTrgoods(trobj)
            {

                trobj.parent().parent().remove();
            }
            function delThigoods(trobj,id) {
                if(confirm('确认删除？')){
                    $.ajax({
                        url : '{:url("service_order_goods")}',
                        data:{'id':id},
                        dataType:'html',
                        success:function(data){
                            data = JSON.parse(data);
                            console.log(data)
                            if(data.code == 200){
                                layer.msg('删除成功');
                                trobj.parent().parent().remove();
                            }else{
                                layer.msg(data.message);
                            }
                        }
                    });
                }
            }
            function inventory(t,number) {
                console.log($(this));
                var spec_id = $(t).parent().prev().find('select').val();

                $.ajax({
                    url : '{:url("service_order/inventory")}',
                    data:{'number':number,'spec_id':spec_id},
                    dataType:'json',
                    success:function(data){
                        if(data.code != 200){
                            layer.msg(data.message);
                            return false;
                        }
                    }
                });
//        $('name=["spec_id"]').val();
//        if(number > inventory){
//            layer.msg('商品数量大于库存数量');
//        }
            }
            function goods_list(id,t){
                $.ajax({
                    url : '{:url("service_order/goods_list")}',
                    data:{'cat_id':id},
                    dataType:'json',
                    success:function(data){
                        var str = [];
                        console.log(data);
                        str = '<select name="spec_id[]" class="form-control" tabindex="-1">';
                        $.each(data, function(k,v){
                            str += '<option value="'+v.id+'">'+'&nbsp&nbsp'.repeat(v.count)+'|--'+v.shop_title+'-'+v.title+'-'+v.attribute+'-'+v.inventory+'</option>';
                        });
                        str += '</select>';
                        $(t).parent().next().html(str);
//                console.log(str);
                    }
                });
            }
        </script>
</body>

</html>
